package com.bytedance.article.common.c;

import android.app.Activity;
import android.content.Intent;
import android.os.Environment;
import android.support.v4.app.Fragment;
import com.bytedance.common.utility.UIUtils;
import com.ss.android.article.browser.R;
import com.ss.android.common.app.permission.PermissionsResultAction;

final class c extends PermissionsResultAction {
    private final Activity a;
    private final Fragment b;
    private final int c;

    c(Activity arg1, Fragment arg2, int arg3) {
        this.a = arg1;
        this.b = arg2;
        this.c = arg3;

    }

    public final void onGranted() {
        int v3 = R.drawable.close_popup_textpage;
        if(!"mounted".equals(Environment.getExternalStorageState())) {
            UIUtils.showImageToast(this.a, v3, R.string.photo_error_no_sdcard);
            return;
        }

        Intent v0 = new Intent();
        v0.setType("image/*");
        v0.setAction("android.intent.action.GET_CONTENT");
        try {
            if(this.b != null) {
                this.b.startActivityForResult(v0, this.c);
                return;
            }

            this.a.startActivityForResult(v0, this.c);
        }
        catch(Exception v0_1) {
            UIUtils.showImageToast(this.a, v3, R.string.photo_error_no_gallery);
        }
    }

    public final void onDenied(String arg1) {
    }
}

